package com.src.http;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.gson.Gson;

import kuaidi.KOrderInfo;
import kuaidi.Query;
/*
 * anposten,youzhengguonei,bangsongwuliu,huitongkuaidi,brazilpost
 * dhl,datianwuliu,debangwuliu,danmarkpost,ems,emsguoji
 * rufengda,fedex,guotongkuaidi,youzhengguonei,gongsuda
 * youzhengguoji,huitongkuaidi,tiandihuayu,huiqiangkuaidi
 * jiajiwuliu,jiayiwuliu,canpost,kuaijiesudi,lianbangkuaidi
 * lianhaowuliu,ganzhongnengda,rufengda,ruidianyouzheng,japanpost
 * quanyikuaidi,quanfengkuaidi,quanritongkuaidi,shentong
 * shunfeng,suer,tnt,tiantian,tiandihuayu,ups,usps,
 * xinbangwuliu,neweggozzo,yuantong,yunda,youzhengguonei,
 * youshuwuliu,zhongtong,zhongtiewuliu,zhaijisong,zhongyouwuliu
 * */
/**
 * Servlet implementation class http
 */
public class main extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private  String stringkuaidi[]=
	{
			"anposten","youzhengguonei","bangsongwuliu","huitongkuaidi","brazilpost",
			"dhl","datianwuliu","debangwuliu","danmarkpost","ems","emsguoji",
			"rufengda","fedex","guotongkuaidi","youzhengguonei","gongsuda",
			 "youzhengguoji","huitongkuaidi","tiandihuayu","huiqiangkuaidi",
			 "jiajiwuliu","jiayiwuliu","canpost","kuaijiesudi","lianbangkuaidi",
			 "lianhaowuliu","ganzhongnengda","rufengda","ruidianyouzheng","japanpost",
			 "quanyikuaidi","quanfengkuaidi","quanritongkuaidi","shentong",
			 "shunfeng","suer","tnt","tiantian","tiandihuayu","ups","usps",
			 "xinbangwuliu","neweggozzo","yuantong","yunda","youzhengguonei",
			 "youshuwuliu","zhongtong","zhongtiewuliu","zhaijisong","zhongyouwuliu"," ",
			 };

    /**
     * Default constructor. 
     */
    public main() {
        // TODO Auto-generated constructor stub
    }
    
	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		String type = request.getParameter("type");
		String no = request.getParameter("no");
		System.out.println(type+","+no);
    	KOrderInfo aa = null;
    	response.setContentType("text/html");
    	response.setCharacterEncoding("UTF-8");
    	PrintWriter printWriter  = response.getWriter();
    	for(int i = 0;stringkuaidi[i+1]!=" ";i++)
    	{
    		if(type.equals(stringkuaidi[i]))
    			printWriter.println("<h1>have answer</h1>");
    			
    	}
    	
		try {
			aa = Query.get("yunda", "1900330840346");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			printWriter.println("<h1>no answer</h1>");
    	}
		System.out.print(aa);
		printWriter.println("<h2>"+aa+"</h2>");
		//printWriter.println("<h1>no answer</h1>");
       
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
